Skip to content

Conversation

@glennj
Copy link
Contributor

@glennj glennj commented Oct 30, 2025

A check digit can only be one character, even if the "sum" is divisible by eleven.

Given 3-598-21508-96, suppose we take the weighted sum of the first 9 digits and then add the remaining digits as the "check digit":

$ sh -c  'echo $(( (10*3 + 9*5 + 8*9 + 7*8 + 6*2 + 5*1 + 4*5 + 3*0 + 2*8 + 96) % 11 ))'
0

It should still be invalid for violating the description:

The ISBN-10 format is 9 digits (0 to 9) plus one check character (either a digit or an X only).

Forum: http://forum.exercism.org/t/yet-another-isbn-edge-case-found/19787

@glennj glennj merged commit 9d3c90b into exercism:main Oct 31, 2025
8 checks passed
kahgoh added a commit to kahgoh/exercism-java that referenced this pull request Oct 31, 2025
jagdish-15 pushed a commit to exercism/java that referenced this pull request Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants